<?php

namespace app\admin\controller\knscy;

use app\common\controller\AdminController;
use EasyAdmin\annotation\ControllerAnnotation;
use EasyAdmin\annotation\NodeAnotation;
use think\App;

/**
 * @ControllerAnnotation(title="knscy_pages")
 */
class Pages extends AdminController
{

    use \app\admin\traits\Curd;

    public function __construct(App $app)
    {
        parent::__construct($app);

        $this->model = new \app\admin\model\KnscyPages();

        $this->assign('getCategoryList', $this->getCategoryList());
        $this->assign('getStatusList', $this->model->getStatusList());

    }

    /**
     * 获取单页的分类
     * @return array
     */
    protected function getCategoryList()
    {
        $data = $this->model->getCategoryList();
        $arr = [];
        foreach ($data as $value) {
            $arr[$value['id']] = $value['title'];
        }
        return $arr;
    }
    /**
     *重新方法，用来获取单页的分类
     */
    public function selectList()
    {
        $data = $this->model->getCategoryList();

        $this->success(null, $data);
    }
}